package com.mybts.util;

import lombok.Data;

/**
 * @author 王志鹏
 * @title: Result
 * @projectName baoge
 * @description: TODO
 * @date 2019/3/28 9:33
 */
@Data
public class Result<T> {

    private Integer code;

    private String msg;

    private T data;

    public static Result success(Object object) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("成功");
        result.setData(object);
        return result;
    }

    public static Result success() {
        return success(null);
    }

    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
